package com.arturjaneczko.components.impl;

import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.util.List;
import java.util.Map;

import com.arturjaneczko.model.impl.EClipboardDataType;

public class ClipboardObject {

	private byte id;
	private Map<String, ClipboardProperty> propertyMap;
	private Transferable transferable;
	private EClipboardDataType clipboardDataType; 

	public byte getId() {
		return id;
	}

	public Map<String, ClipboardProperty> getPropertyMap() {
		return propertyMap;
	}

	public Transferable getTransferable() {
		return transferable;
	}

	public void setId(byte id) {
		this.id = id;
	}

	public void setPropertyMap(Map<String, ClipboardProperty> propertyMap) {
		this.propertyMap = propertyMap;
	}

	public void setTransferable(Transferable transferable) {
		this.transferable = transferable;
		setClipboardDataType(transferable);
	}

	private void setClipboardDataType(Transferable transferable) {
		if (transferable.isDataFlavorSupported(DataFlavor.stringFlavor))
			clipboardDataType = EClipboardDataType.TEXT;
		else if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor))
			clipboardDataType = EClipboardDataType.FILES;
		else if (transferable.isDataFlavorSupported(DataFlavor.imageFlavor))
			clipboardDataType = EClipboardDataType.GRAPHICS;
		else
			clipboardDataType = EClipboardDataType.NOT_SUPPORTED;
	}
	
	public EClipboardDataType getClipboardDataType() {
		return clipboardDataType;
	}

}
